{extend name="app/shop/view/base.html"/}
{block name="resources"}
<link rel="stylesheet" href="STATIC_CSS/promotion_detail.css">
{/block}
{block name="main"}
<div class="layui-card card-common card-brief">
	<div class="layui-card-header">
		<div>
			<span class="card-title">基本信息</span>
		</div>
	</div>
	<div class="layui-card-body">
		<div class="promotion-view">
			<div class="promotion-view-item">
				<label>活动名称：</label>
				<span>{$info.pintuan_name}</span>
			</div>
			<div class="promotion-view-item">
				<label>活动状态：</label>
				<span>{if condition="$info.status == 0"}未开始{/if}{if condition="$info.status == 1"}进行中{/if}{if condition="$info.status == 2"}已结束{/if}{if condition="$info.status == 3"}已失效{/if}</span>
			</div>
			<div class="promotion-view-item">
				<label>拼团人数：</label>
				<span>{$info.pintuan_num}</span>
			</div>
			<div class="promotion-view-item">
				<label>开始时间：</label>
				<span>{:date('Y-m-d H:i:s',$info.start_time)}</span>
			</div>
			<div class="promotion-view-item">
				<label>结束时间：</label>
				<span>{:date('Y-m-d H:i:s',$info.end_time)}</span>
			</div>
			<div class="promotion-view-item">
				<label>单人限制购买数量：</label>
				<span>{$info.buy_num}</span>
			</div>
			<div class="promotion-view-item">
				<label>是否是单独购买：</label>
				<span>{$info.is_single_buy == 0 ? '否' : '是'}</span>
			</div>
			<div class="promotion-view-item">
				<label>是否是虚拟成团：</label>
				<span>{$info.is_virtual_buy == 0 ? '否' : '是'}</span>
			</div>
			<div class="promotion-view-item">
				<label>是否有团长优惠：</label>
				<span>{$info.is_promotion == 0 ? '否' : '是'}</span>
			</div>
			<div class="promotion-view-item">
				<label>是否有团长优惠：</label>
				<span>{$info.is_promotion == 0 ? '否' : '是'}</span>
			</div>
			{switch name='info.reward_type'}
				{case value='1'}
				<div class="promotion-view-item">
					<label>消费余额：</label>
					<span>{$info.reward_type_num}</span>
				</div>
				{/case}
				{case value='2'}
				<div class="promotion-view-item">
					<label>现金红包：</label>
					<span>{$info.reward_type_num}</span>
				</div>
				{/case}
				{case value='4'}
				<div class="promotion-view-item">
					<label>积分：</label>
					<span>{$info.reward_type_num}</span>
				</div>
				{/case}
			{/switch}
		</div>

		{if $info.reward_type == 3}
		{if !empty($info.coupon_list)}
		<div class="promotion-view">
			<div class="promotion-view-item-line">
				<label class="promotion-view-item-custom-label">奖励优惠券如下：</label>
				<div class="promotion-view-item-custom-box">
					{foreach $info.coupon_list as $k => $vo}
					<div>
						<span class="inline-span">优惠券名称：<span class="text-color">{$vo.coupon_name }</span></span>
						&nbsp;&nbsp;
						{if $vo.at_least > 0 }
						<span class="inline-span">优惠券类型：<span class="text-color">满{$vo.at_least }{$vo.type == 'discount' ? '打'. $vo.discount .'折' : '减' . $vo.money }</span></span>
						{else/}
						<span class="inline-span">优惠券金额/折扣：<span class="text-color">满无门槛，{$vo.type == 'discount' ? '打'. $vo.discount .'折' : '减' . $vo.money }</span></span>
						{/if}
					</div>
					{/foreach}
				</div>
			</div>
		</div>
		{/if}
		{/if}
	</div>

</div>

<div class="layui-card card-common card-brief">
	<div class="layui-card-header">
		<div>
			<span class="card-title">数据统计</span>
		</div>
	</div>
	<div class="layui-card-body">
		<div class="promotion-stat-view todo-list">
			<div class="promotion-stat-item" >
				<div class="promotion-stat-item-title">开团数</div>
				<div class="promotion-stat-item-value">{$info.group_num}</div>
			</div>
			<div class="promotion-stat-item" >
				<div class="promotion-stat-item-title">成团数</div>
				<div class="promotion-stat-item-value">{$info.success_group_num}</div>
			</div>

			<div class="promotion-stat-item" >
				<div class="promotion-stat-item-title">订单数</div>
				<div class="promotion-stat-item-value">{$info.order_num}</div>
			</div>
		</div>
	</div>
</div>

<div class="layui-card card-common card-brief">
	<div class="layui-card-header">
		<div>
			<span class="card-title">活动商品</span>
		</div>
	</div>
	<div class="layui-card-body">
		<div class='promotion-view-list'>
			<table id="promotion_list"></table>
		</div>
	</div>
</div>
{/block}
{block name="script"}
<script type='text/html' id="promotion_list_item_box_html">
	<div class="promotion-list-item-title">
		<div class="promotion-list-item-title-icon">
			<img src="{{ ns.img(d.sku_image) }}" alt="">
		</div>
		<p class="promotion-list-item-title-name multi-line-hiding">{{ d.sku_name }}</p>
	</div>
</script>
<script>
	var list = {:json_encode($info.sku_list, JSON_UNESCAPED_UNICODE)};
	layui.use('table', function() {
		new Table({
			elem: '#promotion_list',
			cols: [
				[{
					field: 'sku_name',
					title: '商品名称',
					width: '26%',
					unresize: 'false',
					templet: "#promotion_list_item_box_html"
				}, {
					title: '商品价格(元)',
					unresize: 'false',
					align: 'left',
					width: '20%',
					templet: function(data) {
						return '￥' + data.price;
					}
				}, {
					title: '拼团价格(元)',
					unresize: 'false',
					width: '20%',
					templet: function(data) {
						return '￥' + data.pintuan_price;
					}
				},
					{if condition="$info.is_promotion == 1"}
					{
						title: '团长优惠价(元)',
						unresize: 'false',
						templet: function(data) {
							return '￥' + data.promotion_price;
						}
					}
					{/if}
				]
			],
			data: list
		});
	});

</script>
{/block}

